home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Burning & Media / GB-PVR 1.2.13 / GBPVR10213.msi / Cabs.w1.cab / Library2.aspx.cs460 < prev    next >
Text File  |  2008-02-23  |  31KB  |  644 lines

  1. //===========================================================================
  2. // This file was modified as part of an ASP.NET 2.0 Web project conversion.
  3. // The class name was changed and the class modified to inherit from the abstract base class 
  4. // in file 'App_Code\Migrated\Stub_Library_aspx_cs.cs'.
  5. // During runtime, this allows other classes in your web application to bind and access 
  6. // the code-behind page using the abstract base class.
  7. // The associated content page 'Library.aspx' was also modified to refer to the new class name.
  8. // For more information on this code pattern, please refer to http://go.microsoft.com/fwlink/?LinkId=46995 
  9. //===========================================================================
  10. using System;
  11. using System.Collections;
  12. using System.Diagnostics;
  13. using System.Drawing;
  14. using System.Globalization;
  15. using System.IO;
  16. using System.Text.RegularExpressions;
  17. using System.Web;
  18. using GBPVR.Public;
  19. using gbweb.classes;
  20. using TagLib.Id3v2;
  21. using TagLib.Asf;
  22. using File=System.IO.File;
  23.  
  24. namespace gbweb
  25. {
  26.     /// <summary>
  27.     /// Summary description for Library.
  28.     /// </summary>
  29.     public partial class Migrated_Library2 : Library
  30.     {
  31.  
  32.         protected string Mode;
  33.         protected string DisplayPath;
  34.         private Settings guideParams;
  35.         private const string folderDiv1 = "<div class=\"folder\">";
  36.         private const string endDiv = "</div>";
  37.         private const string fileDiv1 = "<div class=\"file\">";
  38.         private const string tagInfoDiv = "<a class=\"toolTip\" href=\"#\">";
  39.         private const string photoDiv1 = "<div id=\"FILE_LIST\">";
  40.         private const string streamButton = "<div class=\"butStream\">";
  41.         private const string playButton = "<div class=\"butPlay\">";
  42.         private const string downloadButton = "<div class=\"butDownload\">";
  43.         private const string albumPic1 = "<img src=\"";
  44.         private const string albumPic2 = "\" alt=\"\" width=\"240\" height=\"240\" border=\"0\" hspace=\"0\" vspace=\"0\">";
  45.         private bool photoLibrary = false;
  46.         private string folder = string.Empty;
  47.         private Process proc;
  48.         private ProcessStartInfo psi;
  49.  
  50.         protected void Page_Load(object sender, EventArgs e)
  51.         {
  52.             //General housekeeping
  53.             Session["GuideStartTime"] = null;
  54.             guideParams = Global.Settings;
  55.  
  56.             //Code to prevent Guest users from accessing the Admin and search Pages
  57.             if (!Convert.ToBoolean((string)Session["NotGuestUser"]))
  58.             {
  59.                 NAV_SEARCH.Visible = false;
  60.                 NAV_CONFIG.Visible = false;
  61.             }
  62.  
  63.             NAV_TREE.InnerHtml = string.Empty;
  64.  
  65.             //Check to see if the user has VLC installed and configured
  66.             bool strmAllowed = File.Exists(Path.Combine(guideParams.strmVLCLoc, "vlc.exe"));
  67.  
  68.             //Intialize a cookie variable
  69.             HttpCookie cookie;
  70.             
  71.             //Get the path parameter to see where we are navigating to
  72.             string vpath = string.Empty;
  73.             string picName = string.Empty;
  74.  
  75.             if (!IsPostBack)
  76.             {
  77.                 //Set the Day/date/time display on the header
  78.                 viewDate.InnerText = DateTime.Now.ToLongDateString().Trim();
  79.                 serverTime.InnerText = "Server Time: " + DateTime.Now.ToLongTimeString().Trim();
  80.                 
  81.                 NAV_RECORDINGS.Visible = guideParams.showManage;
  82.                 if (Convert.ToBoolean((string)Session["NotGuestUser"]))
  83.                 {
  84.                     NAV_SEARCH.Visible = guideParams.showSearch;
  85.                 }
  86.                 NAV_VIDEO.Visible = guideParams.showVideoLib;
  87.                 NAV_MUSIC.Visible = guideParams.showMusicLib;
  88.                 NAV_PHOTO.Visible = guideParams.showPhotoLib;
  89.                 NAV_STATS.Visible = guideParams.showStats;
  90.  
  91.                 //Get the saved coode for the default size of the photo.....this is remembered from session to session
  92.                 cookie = Request.Cookies["photoSize"];
  93.                 photo_Size.SelectedValue = cookie != null ? cookie.Value : "2";
  94.             }
  95.  
  96.             if ((Request.Params["pic"] != null) && (Request.Params["pic"].Length !=0))
  97.             {
  98.                 picName = Request.Params["pic"];
  99.             }
  100.  
  101.             if ((Request["path"] != null) && (Request["path"].Length != 0))
  102.             {
  103.                 vpath = Request["path"];
  104.                 if (picName != string.Empty)
  105.                 {
  106.                     picture.ImageUrl =
  107.                         Download.GetDownloadUrl(false, true, Download.InternalFiles.Photo,
  108.                                                 PublicDownload.Serialize(Path.Combine(GetRealPath(vpath), picName)));
  109.                     GRAPHICS.Visible = true;
  110.  
  111.                     //Create an image from the file location
  112.                     Image image =
  113.                         Image.FromFile(Path.Combine(GetRealPath(vpath), picName));
  114.  
  115.                     //Get pull the filename from the picture path to be displayed to the user
  116.                     string photoinfo = picName;
  117.  
  118.                     //Pull the image dimensions from the image to be displayed to the user
  119.                     photoinfo += " - Actual Size: " + image.Width + "x" + image.Height;
  120.  
  121.                     //Set the info lable to the value of the filename of the image and the image dimensions
  122.                     photoInfo.Text = photoinfo;
  123.  
  124.                     //Set the image display size
  125.                     switch (photo_Size.SelectedValue)
  126.                     {
  127.                         case "0":
  128.                             {
  129.                                 picture.Height = image.Height;
  130.                                 picture.Width = image.Width;
  131.                                 break;
  132.                             }
  133.                         case "1":
  134.                             {
  135.                                 picture.Height = Convert.ToInt32(image.Height*.75);
  136.                                 picture.Width = Convert.ToInt32(image.Width*.75);
  137.                                 break;
  138.                             }
  139.                         case "2":
  140.                             {
  141.                                 picture.Height = Convert.ToInt32(image.Height*.50);
  142.                                 picture.Width = Convert.ToInt32(image.Width*.50);
  143.                                 break;
  144.                             }
  145.                         case "3":
  146.                             {
  147.                                 picture.Height = Convert.ToInt32(image.Height*.25);
  148.                                 picture.Width = Convert.ToInt32(image.Width*.25);
  149.                                 break;
  150.                             }
  151.                         case "4":
  152.                             {
  153.                                 picture.Height = Convert.ToInt32(image.Height*.10);
  154.                                 picture.Width = Convert.ToInt32(image.Width*.10);
  155.                                 break;
  156.                             }
  157.                         default:
  158.                             {
  159.                                 picture.Height = Convert.ToInt32(image.Height*.50);
  160.                                 picture.Width = Convert.ToInt32(image.Width*.50);
  161.                                 break;
  162.                             }
  163.                     }
  164.  
  165.                     //If the user has choosen to rotate the image then we need to process the image and reset the image sizeing
  166.                     //to work with the rotation option
  167.                     if (photo_Rotation.SelectedValue != "0")
  168.                     {
  169.                         //We must set the url of the rotated image to call download.ashx so that it can be streamed back to the image control
  170.                         picture.ImageUrl =
  171.                             Download.GetDownloadUrl(false, true, Download.InternalFiles.ModifiedPhoto,
  172.                                                     PublicDownload.Serialize(Path.Combine(GetRealPath(vpath), picName) + "~" + picture.Height.Value + "~" +
  173.                                                                              picture.Width.Value + "~" +
  174.                                                                              photo_Rotation.SelectedValue));
  175.                         //Depending on the rotation option the height and width of the image control need to be swapped.
  176.                         switch (photo_Rotation.SelectedValue)
  177.                         {
  178.                             case "1":
  179.                                 {
  180.                                     double H = picture.Height.Value;
  181.                                     double W = picture.Width.Value;
  182.                                     picture.Height = Convert.ToInt32(W);
  183.                                     picture.Width = Convert.ToInt32(H);
  184.                                     break;
  185.                                 }
  186.                             case "3":
  187.                                 {
  188.                                     double H = picture.Height.Value;
  189.                                     double W = picture.Width.Value;
  190.                                     picture.Height = Convert.ToInt32(W);
  191.                                     picture.Width = Convert.ToInt32(H);
  192.                                     break;
  193.                                 }
  194.                         }
  195.                     }
  196.                     //Cleanup
  197.                     image.Dispose();
  198.                 }
  199.             }
  200.  
  201.  
  202.             //Store the selected sort order in the cookie for the next image display
  203.             cookie = new HttpCookie("photoSize", photo_Size.SelectedValue);
  204.             cookie.Expires = DateTime.Now.AddYears(1);
  205.             Response.Cookies.Add(cookie);
  206.                 
  207.             
  208.             //Split the path into an array
  209.             string[] pathparts = vpath.Split(new char[] {'/'}, 3);
  210.             
  211.             //Set the display to show what library we are looking at....Music or Video
  212.             Mode = CultureInfo.CurrentUICulture.TextInfo.ToTitleCase(pathparts[0]);
  213.  
  214.             if (Mode.ToLower() == "music")
  215.             {
  216.                 streamSettings.PostBackUrl = "public/player2.aspx?playerType=2";
  217.                 streamSettings.Attributes.Add("onclick", "EditPop5(\"public/player2.aspx?playerType=2\",'Add1');return false;");
  218.             }
  219.             else
  220.             {
  221.                 streamSettings.PostBackUrl = "public/player2.aspx?playerType=1";
  222.                 streamSettings.Attributes.Add("onclick", "EditPop5(\"public/player2.aspx?playerType=1\",'Add1');return false;");
  223.             }
  224.  
  225.             //Set the file extension filter for whatever we are viewing
  226.             Regex fileFilter = GetRegex(Mode);
  227.  
  228.             //Set the header tab to active for the appropriate view
  229.             switch (Mode.ToLower())
  230.             {
  231.                 case "video":
  232.                     NAV_VIDEO.Attributes.Add("class", "currentTab");
  233.                     libraryTitle.InnerText = "Video Library";
  234.                     NAVIGATION_MUSIC.ID = "NAVIGATION_VIDEO";
  235.                     libraryBody.Attributes.Clear();
  236.                     libraryBody.Attributes.Remove("id");
  237.                     libraryBody.ID = "libraryBody";
  238.                     libraryBody.Attributes.Add("onload", "GetServerTime(), GetReminders(), StartUp()");
  239.                     SPACER.Visible = false;
  240.                     MusicVideoControls.Visible = true;
  241.                     ALBUM_ART.Visible = false;
  242.                     playAlbum.Visible = false;
  243.                     streamAlbum.Visible = false;
  244.                     streamerSettings.Visible = false;
  245.                     PHOTO.Visible = false;
  246.                     PHOTO_INFO.Visible = false;
  247.                     formPhotoViewer.Visible = false;
  248.                     photoLibrary = false;
  249.                     if (GetStreamerStatus() != "")
  250.                     {
  251.                         streamMessage.InnerHtml = "Streaming is Active";
  252.                     }
  253.                     else
  254.                     {
  255.                         streamMessage.InnerHtml = "";
  256.                     }
  257.                     break;
  258.                 case "music":
  259.                     NAV_MUSIC.Attributes.Add("class", "currentTab");
  260.                     libraryTitle.InnerText = "Music Library";
  261.                     NAVIGATION_MUSIC.ID = "NAVIGATION_MUSIC";
  262.                     libraryBody.Attributes.Clear();
  263.                     libraryBody.ID = "libraryBody";
  264.                     libraryBody.Attributes.Add("onload", "GetServerTime(), GetReminders(), StartUp()");
  265.                     SPACER.Visible = false;
  266.                     MusicVideoControls.Visible = true;
  267.                     ALBUM_ART.Visible = false;
  268.                     playAlbum.Visible = false;
  269.                     streamAlbum.Visible = false;
  270.                     streamerSettings.Visible = false;
  271.                     PHOTO.Visible = false;
  272.                     PHOTO_INFO.Visible = false;
  273.                     formPhotoViewer.Visible = false;
  274.                     photoLibrary = false;
  275.                     if (GetStreamerStatus() != "")
  276.                     {
  277.                         streamMessage.InnerHtml = "Streaming is Active";
  278.                     }
  279.                     else
  280.                     {
  281.                         streamMessage.InnerHtml = "";
  282.                     }
  283.                     break;
  284.                 case "photo":
  285.                     NAV_PHOTO.Attributes.Add("class", "currentTab");
  286.                     libraryTitle.InnerText = "Photo Library";
  287.                     NAVIGATION_MUSIC.ID = "NAVIGATION_PHOTO";
  288.                     libraryBody.Attributes.Clear();
  289.                     libraryBody.ID = "bodyPhoto";
  290.                     libraryBody.Attributes.Add("onload", "GetServerTime(), GetReminders(),StartUp()");
  291.                     SPACER.Visible = true;
  292.                     MusicVideoControls.Visible = false;
  293.                     ALBUM_ART.Visible = false;
  294.                     playAlbum.Visible = false;
  295.                     streamAlbum.Visible = false;
  296.                     streamerSettings.Visible = false;
  297.                     PHOTO.Visible = true;
  298.                     PHOTO_INFO.Visible = true;
  299.                     formPhotoViewer.Visible = true;
  300.                     photoLibrary = true;
  301.                     break;
  302.             }
  303.  
  304.             string path = GetRealPath(vpath);
  305.  
  306.             ArrayList folders = new ArrayList();
  307.             ArrayList files = new ArrayList();
  308.             string albumArtist = string.Empty;
  309.  
  310.             if (pathparts.Length == 1)
  311.             {
  312.                 Hashtable directories = (Hashtable)HttpContext.Current.Session[Mode + "LibraryDirectories"];
  313.                 ArrayList keys = new ArrayList(directories.Keys);
  314.                 keys.Sort();
  315.                 foreach (string name in keys)
  316.                     folders.Add(name);
  317.             }
  318.             else
  319.             {
  320.                 if (pathparts.Length == 2)
  321.                 {
  322.                     DisplayPath = " - " + pathparts[1];
  323.                     libraryTitle.InnerText += DisplayPath;
  324.                 }
  325.                 else if (pathparts.Length == 3)
  326.                 {
  327.                     DisplayPath = " - " + pathparts[1] + "/" + pathparts[2];
  328.                     libraryTitle.InnerText += DisplayPath;
  329.                 }
  330.  
  331.                 try
  332.                 {
  333.                     folders.Add("..");
  334.  
  335.                     string[] dirs = Directory.GetDirectories(path);
  336.                     Array.Sort(dirs);
  337.                     foreach (string dir in dirs)
  338.                     {
  339.                         if (dir == Path.GetFullPath(dir))
  340.                             folders.Add(Path.GetFileName(dir));
  341.                     }
  342.  
  343.                     string[] filenames = Directory.GetFiles(path);
  344.                     Array.Sort(filenames);
  345.                     foreach (string filename in filenames)
  346.                     {
  347.                         if (filename == Path.GetFullPath(filename))
  348.                         {
  349.                             string fileName = Path.GetFileName(filename);
  350.                                         //Set the header tab to active for the appropriate view
  351.  
  352.                             try
  353.                             {
  354.                                 switch (fileName.Substring(fileName.Length - 3))
  355.                                 {
  356.                                     case "mp3":
  357.                                         TagLib.File file = TagLib.File.Create(filename);
  358.                                         TagLib.Id3v2.Tag id32_tag = file.GetTag(TagLib.TagTypes.Id3v2) as TagLib.Id3v2.Tag;
  359.                                         if (id32_tag != null && !id32_tag.IsEmpty)
  360.                                         {
  361.                                             string tagInfo = string.Empty;
  362.                                             if (id32_tag.Album != null)
  363.                                             {
  364.                                                 tagInfo += "<b>Album: </b>" + id32_tag.Album +
  365.                                                           "<img height=\"1\" src=\"themes2/common/graphics/spacer.gif\" width=\"7\" border=\"0\"></img>";
  366.                                             }
  367.                                             if (id32_tag.Performers[0] != null)
  368.                                             {
  369.                                                 tagInfo += "<b>Artist: </b>" + id32_tag.Performers[0] +
  370.                                                            "<img height=\"1\" src=\"themes2/common/graphics/spacer.gif\" width=\"7\" border=\"0\"></img>";
  371.                                                 if (albumArtist == string.Empty)
  372.                                                 {
  373.                                                     albumArtist = id32_tag.Performers[0];
  374.                                                 }
  375.                                             }
  376.                                             if (id32_tag.Copyright!= null)
  377.                                             {
  378.                                                 tagInfo += "<b>Copyright: </b>" + id32_tag.Copyright +
  379.                                                            "<img height=\"1\" src=\"themes2/common/graphics/spacer.gif\" width=\"7\" border=\"0\"></img>";
  380.                                             }
  381.                                             if (id32_tag.Title!= null)
  382.                                             {
  383.                                                 tagInfo += "<b>Title: </b>" + id32_tag.Title +
  384.                                                            "<img height=\"1\" src=\"themes2/common/graphics/spacer.gif\" width=\"7\" border=\"0\"></img>";
  385.                                             }
  386.                                             if (id32_tag.Track != null)
  387.                                             {
  388.                                                 tagInfo += "<b>Track: </b>" + id32_tag.Track +
  389.                                                            "<img height=\"1\" src=\"themes2/common/graphics/spacer.gif\" width=\"7\" border=\"0\"></img>"; ;
  390.                                             }
  391.                                             if (id32_tag.Year != null)
  392.                                             {
  393.                                                 tagInfo += "<b>Year: </b>" + id32_tag.Year;
  394.                                             }
  395.                                             files.Add(fileName + "|" + tagInfo);
  396.                                         }
  397.                                         else
  398.                                         {
  399.                                             files.Add(fileName + "|");
  400.                                         }
  401.                                         break;
  402.                                     case "wma":
  403.                                         TagLib.File wma_file = TagLib.File.Create(filename);
  404.                                         TagLib.Asf.Tag wma_tag = wma_file.GetTag(TagLib.TagTypes.Asf) as TagLib.Asf.Tag;
  405.                                         if (wma_tag != null && !wma_tag.IsEmpty)
  406.                                         {
  407.                                             string tagInfo = string.Empty;
  408.                                             if (wma_tag.Album != null)
  409.                                             {
  410.                                                 tagInfo += "<b>Album: </b>" + wma_tag.Album +
  411.                                                           "<img height=\"1\" src=\"themes2/common/graphics/spacer.gif\" width=\"7\" border=\"0\"></img>";
  412.                                             }
  413.                                             if (wma_tag.JoinedAlbumArtists != null)
  414.                                             {
  415.                                                 tagInfo += "<b>Artists: </b>" + wma_tag.JoinedAlbumArtists +
  416.                                                            "<img height=\"1\" src=\"themes2/common/graphics/spacer.gif\" width=\"7\" border=\"0\"></img>";
  417.                                                 if (albumArtist == string.Empty)
  418.                                                 {
  419.                                                     albumArtist = wma_tag.JoinedAlbumArtists;
  420.                                                 }
  421.                                             }
  422.                                             if (wma_tag.Copyright != null)
  423.                                             {
  424.                                                 tagInfo += "<b>Copyright: </b>" + wma_tag.Copyright +
  425.                                                            "<img height=\"1\" src=\"themes2/common/graphics/spacer.gif\" width=\"7\" border=\"0\"></img>";
  426.                                             }
  427.                                             if (wma_tag.Title != null)
  428.                                             {
  429.                                                 tagInfo += "<b>Title: </b>" + wma_tag.Title +
  430.                                                            "<img height=\"1\" src=\"themes2/common/graphics/spacer.gif\" width=\"7\" border=\"0\"></img>";
  431.                                             }
  432.                                             if (wma_tag.Track != null)
  433.                                             {
  434.                                                 tagInfo += "<b>Track: </b>" + wma_tag.Track +
  435.                                                            "<img height=\"1\" src=\"themes2/common/graphics/spacer.gif\" width=\"7\" border=\"0\"></img>"; ;
  436.                                             }
  437.                                             if (wma_tag.Year != null)
  438.                                             {
  439.                                                 tagInfo += "<b>Year: </b>" + wma_tag.Year;
  440.                                             }
  441.                                             files.Add(fileName + "|" + tagInfo);
  442.                                         }
  443.                                         else
  444.                                         {
  445.                                             files.Add(fileName + "|"); 
  446.                                         }
  447.                                         break;
  448.                                     default:
  449.                                         files.Add(fileName + "|");
  450.                                         break;
  451.                                 }
  452.                             }
  453.                             catch (Exception ex)
  454.                             {
  455.                                 files.Add(fileName + "|");
  456.                                 Logger.Error(ex.ToString());
  457.                             }
  458.  
  459.                         }
  460.                     }
  461.                 }
  462.                 catch (Exception ex)
  463.                 {
  464.                     Logger.Error(ex.ToString());
  465.                 }
  466.             }
  467.  
  468.             string root = string.Join("/", pathparts);
  469.             if (root.Length > 0) root += "/";
  470.             
  471.             ArrayList library = new ArrayList();
  472.             foreach (string folder in folders)
  473.             {
  474.                 if (folder != "..")
  475.                 {
  476.                     path = Server.UrlEncode(root) + Server.UrlEncode(folder);
  477.                 }
  478.                 else
  479.                 {
  480.                     path = string.Join("/", pathparts);
  481.                     path = path.Substring(0, path.LastIndexOf("/"));
  482.                     path = Server.UrlEncode(path);
  483.                 }
  484.  
  485.                 library.Add(folderDiv1 + "<a href=\"?path=" + path + "\" >[" + folder + "]</a>" + endDiv);
  486.             }
  487.  
  488.             Regex coverFilter;
  489.             if (albumArtist != string.Empty)
  490.             {
  491.                 coverFilter =
  492.                     new Regex(Global.Settings.coverFiles.Replace("~", albumArtist), RegexOptions.Compiled | RegexOptions.IgnoreCase);
  493.             }
  494.             else
  495.             {
  496.                 coverFilter =
  497.                     new Regex(Global.Settings.coverFiles.Replace("~|", ""), RegexOptions.Compiled | RegexOptions.IgnoreCase);
  498.             }
  499.             string mediaButton = string.Empty;
  500.             
  501.             if (photoLibrary)
  502.             {
  503.                 library.Add(photoDiv1);
  504.             }
  505.             foreach (string file in files)
  506.             {
  507.  
  508.                 //Pull out Tag info if present
  509.                 string[] fileParts = file.Split(new char[] { '|' }, 2);
  510.  
  511.                 if (!photoLibrary)
  512.                 {
  513.                     if (fileFilter.IsMatch(fileParts[0]))
  514.                     {
  515.                         string fileName = string.Empty;
  516.                         mediaButton = string.Empty;
  517.                         playAlbum.Visible = true;
  518.  
  519.                         if (fileParts.Length > 1 && fileParts[1].Length > 0)
  520.                         {
  521.                             fileName = fileDiv1 + tagInfoDiv + fileParts[0] + "<span>" + fileParts[1] + "</span></a></br>"; 
  522.                         }
  523.                         else
  524.                         {
  525.                             fileName = fileDiv1 + fileParts[0] + "</br>"; 
  526.                         }
  527.                        
  528.                         library.Add(fileName);
  529.                         if (strmAllowed)
  530.                         {
  531.                             if (Mode.ToLower() == "music")
  532.                             {
  533.                                 mediaButton += streamButton + "<a href=\"public/Player2.aspx?playerType=2&path=" + Server.UrlEncode(root.Substring(0, root.Length - 1)) + "&mvid=" + Server.UrlEncode(PublicDownload.Serialize(root + fileParts[0])) + "\"  onclick=\"EditPop5(this.href,'Add1');return false;\" >Stream</a></div>";
  534.                             }
  535.                             else
  536.                             {
  537.                                 mediaButton += streamButton + "<a href=\"public/Player2.aspx?playerType=1&path=" + Server.UrlEncode(root.Substring(0, root.Length - 1)) + "&mvid=" + Server.UrlEncode(PublicDownload.Serialize(root + fileParts[0])) + "\"  onclick=\"EditPop5(this.href,'Add1');return false;\" >Stream</a></div>";
  538.                             }
  539.                         }
  540.                         mediaButton += playButton + "<a href=\"" +
  541.                                        Download.GetDownloadUrl(false, false, Download.InternalFiles.LibraryFile,
  542.                                                                root + fileParts[0]) +
  543.                                        "\">Play</a>" + endDiv;
  544.                         mediaButton += downloadButton + "<a href=\"" +
  545.                                        Download.GetDownloadUrl(true, true, Download.InternalFiles.LibraryFile,
  546.                                                                root + fileParts[0]) +
  547.                                        "\">Download</a>" + endDiv + endDiv;
  548.                         library.Add(mediaButton);
  549.                     }
  550.                     if ((coverFilter.IsMatch(fileParts[0])))
  551.                     {
  552.                         ALBUM_ART.Visible = true;
  553.                         ALBUM_ART.InnerHtml = albumPic1 +
  554.                                               Download.GetDownloadUrl(false, true, Download.InternalFiles.LibraryFile,
  555.                                                                       root + fileParts[0]) + albumPic2 + endDiv;
  556.                     }
  557.                 }
  558.                 else
  559.                 {
  560.                     if (fileFilter.IsMatch(fileParts[0]))
  561.                     {
  562.                         library.Add(fileDiv1 + "<a href=\"?path=" + Server.UrlEncode(root.Substring(0, root.Length - 1)) + "&pic=" + Server.UrlEncode(fileParts[0]) + "\">" + fileParts[0] + "</a></div>");
  563.                     }
  564.                 }
  565.             }
  566.  
  567.             if (photoLibrary)
  568.             {
  569.                 library.Add(endDiv);
  570.             }
  571.             else
  572.             {
  573.                 downloadAlbum.Visible = playAlbum.Visible;
  574.                 if (playAlbum.Visible)
  575.                 {
  576.                     playAlbum.InnerHtml = "<a href=\"" + Download.GetDownloadUrl(false, false, Download.InternalFiles.LibraryFolder, root) + "\">Play All</a>";
  577.                     downloadAlbum.InnerHtml = "<a href=\"" + Download.GetDownloadUrl(true, true, Download.InternalFiles.LibraryFolder, root) + "\">Download All</a>";
  578.                     if (strmAllowed)
  579.                     {
  580.                         if (Mode.ToLower() == "music")
  581.                         {
  582.                             streamAlbum.InnerHtml = "<a href=\"public/Player2.aspx?playerType=1&?path=" + Server.UrlEncode(root.Substring(0, root.Length - 1)) + "&mid=" + Server.UrlEncode(PublicDownload.Serialize(root)) + "\"onclick=\"EditPop5(this.href,'Add1');return false;\" >Stream All</a>";
  583.                         }
  584.                         else
  585.                         {
  586.                             streamAlbum.InnerHtml = "<a href=\"public/Player2.aspx?playerType=2&?path=" + Server.UrlEncode(root.Substring(0, root.Length - 1)) + "&mid=" + Server.UrlEncode(PublicDownload.Serialize(root)) + "\"onclick=\"EditPop5(this.href,'Add1');return false;\" >Stream All</a>";
  587.                         }
  588.                         streamAlbum.Visible = true;
  589.                         streamerSettings.Visible = true;
  590.                     }
  591.                 }
  592.             }
  593.  
  594.             //Load all the directory/file info collected in this pass to the page for rendering
  595.             for (int a = 0; a < library.Count; a++)
  596.             {
  597.                 NAV_TREE.InnerHtml += (string) library[a] + "\n";
  598.             }
  599.  
  600.         }
  601.  
  602.         public static string GetStreamerStatus()
  603.         {
  604.             string streamActive = "";
  605.             //Check processes running on the seerver.  If VLC is running assuming streaming is active
  606.             try
  607.             {
  608.                 foreach (Process thisproc in Process.GetProcessesByName("vlc"))
  609.                 {
  610.                     streamActive = "true";
  611.                     continue;
  612.                 }
  613.             }
  614.             catch (Exception Exc)
  615.             {
  616.             }
  617.  
  618.             return streamActive;
  619.         }
  620.  
  621.         #region Web Form Designer generated code
  622.         override protected void OnInit(EventArgs e)
  623.         {
  624.             //
  625.             // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  626.             //
  627.             InitializeComponent();
  628.             base.OnInit(e);
  629.         }
  630.  
  631.         /// <summary>
  632.         /// Required method for Designer support - do not modify
  633.         /// the contents of this method with the code editor.
  634.         /// </summary>
  635.         private void InitializeComponent()
  636.         {
  637.  
  638.         }
  639.         #endregion
  640.  
  641.     }
  642.  
  643. }
  644.